<style>
<!--
.form_editar_registro{background-color:white; padding:15px;}

.linea_edit_registro{width:100%;  float:left; padding-top:0.5em; }
.text_form_edit_registro{width:30%; float:left;}
.text_form_edit_registro label {size:1.5em;}
.input_form_edit_registro{ width:50%; float:left;}
.opciones_edit_registro{width:90%; padding:1em 0em 0em 3em;  float:left;}
-->
</style>
<div id="dialog_<?php echo($id_div); ?>" class="form_editar_registro" >
	<form id="ff_<?php echo($id_div); ?>" method="post">
		<?php for($i=0;$i<count($campos);$i++){ //recorremos todos los campos de la tabla y montamos el formulario
				$campo = $campos[$i]['campo']; 	?>
		<div class="linea_edit_registro">
			<div class="text_form_edit_registro">	
				<label for="<?php echo($campo);?>"><?php echo($campo);?>:</label>
			</div>
			<div class="input_form_edit_registro">
				<input class="easyui-validatebox" type="text" name="<?php echo($campo);?>" onchange="javascript:comprobarCaracteres(this.value);"  value="<?php echo($info_registro[$campo]);?>"/>
	    	</div>
	    </div>
	    <?php } ?>
	    <div class="opciones_edit_registro">
	    	<input type="submit" class="easyui-linkbutton" value="Submit" id="submit_form"></input>
	   		<input type="button" class="easyui-linkbutton" value="Borrar Registro" id="delete_row_<?php echo($id_div); ?>"></input>
	    	<input type="button" class="easyui-linkbutton" value="Cerrar" id="cerrar_form_<?php echo($id_div);?>"></input>
	    	<div id="win"></div>
	    </div>
	</form>
</div>

<script>

load_dialog_registro('<?php echo($bbdd);?>','<?php echo($tabla);?>','<?php echo($id_registro);?>');

function load_dialog_registro(bbdd,tabla,id_registro){
	

	$('#dialog_'+bbdd+'_'+tabla+'_'+id_registro).dialog({  
	    title: bbdd+'->'+tabla+'-> ID:'+id_registro,  
	    width: 500, 
	    closed: false,  
	    cache: false,
	    modal: true  
	});  
	
	$('#ff_'+bbdd+'_'+tabla+'_'+id_registro).form({
	    url:urlbase+'datos_tabla/update_registro/',
	    onSubmit: function(){
	        alert('submit');
	        // do some check
	        // return false to prevent submit;
	    },
	    success:function(data){
	        alert(data)
	    }
	});
	
	function comprobarCaracteres(texto){
		//alert(texto);
	}
	
	$("#delete_row_"+bbdd+'_'+tabla+'_'+id_registro).click(function() {
	    $('#win').window({
	        width:600,
	        height:400,
	        modal:true
	        });
	});
	
	
	$("#cerrar_form_"+bbdd+'_'+tabla+'_'+id_registro).click(function() {
		$('#dialog_'+bbdd+'_'+tabla+'_'+id_registro).dialog('close');
	});

	$('#btn').linkbutton({
		iconCls: 'icon-search'
	});


}

// submit the form
//$('#ff').submit();
</script>